var AllOptions = {

    createOption2: function(labelList, dataList, unit, name, color) { //产品近6个月抽查不合格变化趋势/产品近6个月不良反应趋势
        return {
            color: [color],
            grid: {
                left: 70,
                top: 50,
                bottom: 45,
                right: 20
            },
            title: {
                text: '单位：' + unit,
                textStyle: {
                    color: '#fff',
                    fontSize: 16
                },
                left: 10,
                top: 10
            },

            xAxis: {
                type: 'category',
                data: labelList,
                axisLabel: {
                    inside: false,
                    textStyle: {
                        color: '#fff',
                        fontSize: 16
                    },
                    interval: 0, //保证所有横向坐标数据全展示不隐藏
                    margin: 10 //刻度与坐标轴距离
                },
                axisTick: {
                    show: false
                },
                axisLine: {
                    show: true, //不显示y轴
                    symbol: ['none'],
                    symbolOffset: [0, 14],
                    lineStyle: {
                        color: 'rgba(1, 60, 217, 1)'
                    }
                },
                splitLine: {
                    show: false, //纵向网格线
                    lineStyle: {
                        color: ['#334c69']
                    }
                }
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    inside: false,
                    textStyle: {
                        color: '#fff',
                        fontSize: 16
                    },
                    // interval: 0,
                    margin: 20 //刻度与坐标轴距离
                },
                axisTick: {
                    show: false //不显示刻度
                },
                axisLine: {
                    show: true, //不显示y轴
                    symbol: ['none'],
                    symbolOffset: [0, 14],
                    lineStyle: {
                        color: 'rgba(1, 60, 217, 1)'
                    }
                },
                splitLine: {
                    show: false, //横向网格线
                    lineStyle: {
                        color: ['#334c69']
                    }
                },
                splitArea: {
                    show: true, //横向网格区域
                    areaStyle: {
                        color: ['rgba(0, 70, 255, 0.1)', 'rgba(5,39,75,0)']
                    }
                }
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: { // 横坐标指示器
                    type: 'line',
                    lineStyle: {
                        color: 'rgba(0,0,0,0)'
                    }
                },
                // alwaysShowContent: true, //悬浮后一直显示
                // 自定义悬浮提示框内容（数据处理后加单位）
                backgroundColor: 'rgba(0,0,0,0)',
                formatter: function(params) { // params的个数等于折线的条数（对多条折线数据进行加单位，就需要遍历）
                    var relVal = '<div class="bg_2_tip" style="text-align:left;padding:20px 30px;font-size:14px "><span style="color:#fff;font-size:20px;">' + params[0].name + '</span>' + (params[0] ? '<br><span class="color-blue-2">' + name + '<span class="color-yellow-2 f20 pl10">' + params[0].value + '</span>' + unit + '</span>' : '') + '</div>'
                    return relVal
                }
            },
            series: [{
                name: '不合格数量',
                type: 'line',
                data: dataList,
                label: {
                    show: true,
                    position: 'bottom',
                    formatter: '{c}',
                    color: '#fff'
                },
                // symbol: 'circle', //
                symbolSize: 12
            }]
        }
    },
    createOption4: function(mapCityJson, dataList) { //地图

        var geoCoordMap = {}
        for (var i = 0; i < mapCityJson.features.length; i++) {
            var name = mapCityJson.features[i].properties.name
            geoCoordMap[name] = mapCityJson.features[i].properties.center
        }
        var formatData = {}//将地址名字和对应的数据转化为map对象
        for (var i = 0; i < dataList.length; i++) {
            var name = dataList[i].name
            formatData[name] = dataList[i].value
        }
        // var convertData = function(data) {
        //     var res = [];
        //     for (var i = 0; i < data.length; i++) {
        //         res.push({
        //             name: data[i].name,
        //             value: data[i].coords.concat(data[i].value)
        //         })
        //     }
        //     return res;
        // };
        echarts.registerMap('zj', mapCityJson); //为了实现阴影效果，所以叠加一层
        echarts.registerMap('zj1', mapCityJson);
        return {
            color: ['rgba(255, 41, 42, 1)', 'rgba(0, 198, 1, 1)'],
            grid: {},
            geo: {
                map: 'zj',
                label: {
                    emphasis: {
                        show: false
                    }
                },
                itemStyle: {
                    normal: {
                        areaColor: '#323c48',
                        borderColor: '#111'
                    },
                    emphasis: {
                        areaColor: '#2a333d'
                    }
                }
            },
            series: [{
                    left: 50,
                    right: 30,
                    top: 20,
                    bottom: 10,
                    name: '',
                    type: 'map',
                    mapType: 'zj', // 自定义扩展图表类型
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                color: '#fff'
                            },
                            areaColor: '#0a0d49',
                            borderWidth: 5,
                            borderColor: '#03c0ff',
                            shadowBlur: 20,

                            shadowColor: '#03c0ff'
                        },
                        emphasis: {
                            label: {
                                show: true
                            }
                        }
                    }
                   
                }, {
                    left: 50,
                    right: 30,
                    top: 20,
                    zlevel: 12,
                    z: 12,
                    bottom: 10,
                    name: '',
                    type: 'map',
                    mapType: 'zj1', // 自定义扩展图表类型
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                color: '#fff',
                                fontSize: 16
                            },
                            areaColor: '#0a0d49',
                            borderWidth: 1,
                            borderColor: '#13358e',

                        },
                        emphasis: {
                            label: {
                                show: true,
                                color:'#fff'
                            },
                            areaColor:'#015ed4',
                        }
                    },
                    data: mapCityJson.features.map(function(item) {
                        if (formatData[item.properties.name]&&formatData[item.properties.name].cityId) {
                            return { name: item.properties.name, value: {cityId:formatData[item.properties.name].cityId} }
                        } else {
                            return { name: item.properties.name,  value:{cityId:'未知城市id'} }
                        }
                    })
                }

            ]
        }
    }

}